ACTOR GrenadeLauncher : BrutalWeapon
{
	Weapon.AmmoUse 0
	Weapon.AmmoGive1 6
	Weapon.AmmoType1 "AmmoRocket"
	Weapon.AmmoType2 "GLAmmo"
	Weapon.PreferredSkin "GL Marine"
    Inventory.PickupSound "ROCKPKUP"
    +WEAPON.NOAUTOAIM
	Weapon.SelectionOrder 8500
	Inventory.PickupMessage "$GOTLAUNCHER"
	//+WEAPON.CHEATNOTWEAPON
	Inventory.ForbiddenTo Sorcerer, Paladin, Corvus
	States
	{
	
	Ready:
	Ready3:
	ReadyLoop:
        GLAN A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		GLAN A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		GLAN A 0 A_JumpIfInventory("Salute2", 1, "Salute")
        GLAN A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		GLAN A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		
		GLAN A 1 A_WeaponReady
		GLAN A 0 A_JumpIfInventory("Unloading", 1, "Unload")
		GLAN A 0 A_JumpIfInventory("Reloading", 1, "Reload")
        Goto Ready
	Deselect:
		GLAN A 0
        GLSW CBA 1
		TNT1 AAAAAAAAA 0 A_Lower
		TNT1 A 1 A_Lower
		Wait
	Select:
		GLAN A 0 A_Giveinventory("GoSpecial",1)
		GLAN A 0 A_Takeinventory("HasBarrel",1)
		TNT1 A 0 A_Raise
		Goto ReadyPlaceholder
		
	ReadyPlaceholder:
	SHSS A 0 
	TNT1 A 0 A_PlaySound("ROCKPKUP")
	GLSE ABCDEF 1 A_WeaponReady(WRF_NOFIRE)
	Goto Ready
		
	Fire:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("GLAmmo", 1, 2)
		Goto NoAmmo
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("GLAmmo", 1)
		GLAN A 0 A_FireCustomMissile("RedFlareSpawn",-5,0,0,0)
		TNT1 AAAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-16,16), 0, -1, random(-9,9))
		GLAN A 0 A_PlaySound("weapons/firegrenade")
		GLAN A 0 A_FireCustomMissile("GrenadeMissileBreaksGlass", 0, 0, 0, 0)
		GLAN A 0 A_ZoomFactor(0.9)
		GLAN A 0 A_Recoil(8)
		GLAF A 1 BRIGHT 
        GLAF C 1
		GLAN A 0 A_ZoomFactor(1.0)
		GLAN A 0 A_FireCustomMissile("ShortGrenade", 0, 1, 0, 0)
		GLAN A 0 A_SetPitch(-8.0 + pitch)
		GLAF CCBBB 1 A_SetPitch(1.0 + pitch)
		GLAN A 5 A_SetPitch(1.0 + pitch)
        Goto NoAmmo2
		
	AltFire:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("GLAmmo", 1, 2)
		Goto NoAmmo
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("GLAmmo", 1)
		GLAN A 0 A_FireCustomMissile("RedFlareSpawn",-5,0,0,0)
		TNT1 AAAAAA 0 BRIGHT A_FireCustomMissile("ShotgunParticles", random(-16,16), 0, -1, random(-9,9))
		GLAN A 0 A_FireCustomMissile("GrenadeMissileBreaksGlass", 0, 0, 0, 0)
		GLAF A 1 BRIGHT 
		
		GLAN A 0 A_PlaySound("weapons/firegrenade")
		GLAN A 0 A_FireCustomMissile("GrenadeMissile", 0, 1, -1, 0)
		GLAN A 0 A_SetPitch(-8.0 + pitch)
		GLAN A 0 A_ZoomFactor(0.9)
		GLAN A 0 A_Recoil(8)
        GLAF C 1
		GLAN A 0 A_ZoomFactor(1.0)
		GLAF CCBBB 1 A_SetPitch(1.0 + pitch)
		GLAN A 5 A_SetPitch(1.0 + pitch)
        Goto NoAmmo2
		
	Reload:	
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("Reloading", 1)
		TNT1 A 0 A_JumpIfInventory("GLAmmo", 1, "Ready3")
		TNT1 A 0 A_JumpIfInventory("AmmoRocket", 1, 2)
		Goto NoAmmo
		TNT1 AA 0
		
		GLR1 ABCDEFGHIJKL 1
		GLAN A 0 A_PlaySound("Weapons/GrenadeOpen")
		GLR1 MMM 1 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		GLR1 NNNN 1 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		GLR1 OPQQRRSS 1
		TNT1 A 0 A_TakeInventory("AmmoRocket", 1)
		TNT1 A 0 A_GiveInventory("GLAmmo", 1)
		GLAN A 0 A_PlaySound("Weapons/GrenadeLoad")
		GLR1 T 1
		GLR1 UVWX 1
		GLAN A 0 A_PlaySound("Weapons/GrenadeClose")
		GLR1 YZ 1
		GLAN A 1
		TNT1 A 0 A_TakeInventory("Reloading", 1)
		Goto Ready
		
		
		
	Unload:	
		GLAN A 1
		TNT1 A 0 A_TakeInventory("Unloading", 1)
		TNT1 A 0 A_TakeInventory("Reloading", 1)
		TNT1 A 0 A_JumpIfInventory("GLAmmo", 1, 2)
		Goto Ready
		TNT1 AA 0
		
		GLR1 ABCDEFGHIJKL 1
		GLAN A 0 A_PlaySound("Weapons/GrenadeOpen")
		TNT1 A 0 A_GiveInventory("AmmoRocket", 1)
		TNT1 A 0 A_TakeInventory("GLAmmo", 1)
		GLR1 T 1
		GLR1 UVWX 1
		GLAN A 0 A_PlaySound("Weapons/GrenadeClose")
		GLR1 YZ 1
		GLAN A 1
		TNT1 A 0 A_TakeInventory("Unloading", 1)
		TNT1 A 0 A_TakeInventory("Reloading", 1)
		Goto Ready	
		
		
	NoAmmo:
		RIFG A 0
		RIFG A 0 A_ZoomFactor(1.0)
		RIFG A 0 A_Takeinventory("Zoomed",1)
		RIFG A 0 A_Takeinventory("ADSmode",1)
		TNT1 A 0 A_PlaySound("weapons/empty", 4)
	NoAmmo2:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("Reloading", 1)
		RIFG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
	    RIFG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		RIFG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		RIFG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		RIFG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		GLAN A 5 A_WeaponReady(WRF_ALLOWRELOAD | WRF_NOFIRE)
		RIFG A 0 A_JumpIfInventory("Reloading",1,"Reload")
		TNT1 A 0 A_JumpIfInventory("NoAutoReload", 1, "NoAmmo2")
		RIFG A 0 A_JumpIfInventory("AmmoRocket",1,"Reload")
		RIFG A 0 A_JumpIfInventory("FiredPrimary",1,"NoAmmo2")
		Goto Ready3	
	
	Spawn:
		GLAP A -1
		Stop
		
	}
}


